import Vue from 'vue'
import App from './App.vue'
import router from './router'
import Vue from 'vue'
import { throttle } from '@/utils/throttle'

// 确保在Vue实例化前挂载
Vue.prototype.$throttle = throttle

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
import './service/flexible.js'
import '@/assets/iconfont/iconfont.css'
import Toast from '@/components/common/Toast.vue'
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')

Vue.component('Toast', Toast)
Vue.prototype.$toast = {
  show: (msg, type = 'info', duration = 3000) => {
    const Constructor = Vue.extend(Toast)
    const instance = new Constructor().$mount()
    document.body.appendChild(instance.$el)
    instance.show(msg, type, duration)
  }
}